﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test05
{
    class Program
    {
        //5.求斐波那契数列前20项的和。
        static void Main(string[] args)
        {
            int n=20;
            int sum=0;
            int[] fib = new int[n];
            fib[0]=1;
            fib[1]=1;
            for (int i=2;i<n-1;i++)
            {
                fib[i] = fib[i-2] + fib[i-1];
            }
            for (int i=0;i<20;i++)
            {
                sum += fib[i];
            }
            Console.WriteLine(sum);
            Console.ReadKey();
        }
    }
}
